
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>odespy.radau5 &mdash; Odespy API 0.2 documentation</title>
    
    <link rel="stylesheet" href="../../_static/pyramid.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="top" title="Odespy API 0.2 documentation" href="../../index.html" />
    <link rel="up" title="Module code" href="../index.html" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="../../_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
<![endif]-->

  </head>
  <body>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../../np-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">Odespy API 0.2 documentation</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <h1>Source code for odespy.radau5</h1><div class="highlight"><pre>
<span class="n">__author__</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Liwei Wang, Univ. of Oslo&#39;</span><span class="p">]</span>

<span class="kn">from</span> <span class="nn">odespy</span> <span class="kn">import</span> <span class="n">Solver</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">sys</span>

<span class="n">_parameters_Radau5</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>

    <span class="n">mas</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
        <span class="n">help</span><span class="o">=</span><span class="s">&#39;&#39;&#39;User-supplied function to</span>
<span class="s">calculate the mass matrix M in the linearly</span>
<span class="s">implicit ODE system M*u&#39; = f(u, t). This function</span>
<span class="s">is used only when M is not I (the identity).</span>
<span class="s">M can be supplied as full matrix or banded</span>
<span class="s">matrix. The ``mas`` function returns M</span>
<span class="s">and takes any number of user-defined parameters</span>
<span class="s">as arguments, given through the parameter</span>
<span class="s">``mas_args``. If M is sparse, a banded</span>
<span class="s">matrix with dimensions ``(mlmas+mumas+1,neq)``</span>
<span class="s">is returned, where ``mlmas`` and ``mumas`` are</span>
<span class="s">the lower and upper half-bandwidth of the banded</span>
<span class="s">matrix, and ``neq`` is the number of equations.</span>
<span class="s">&#39;&#39;&#39;</span><span class="p">,</span>
        <span class="nb">type</span><span class="o">=</span><span class="nb">callable</span><span class="p">),</span>

    <span class="n">mas_args</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
        <span class="n">help</span><span class="o">=</span><span class="s">&#39;&#39;&#39;Extra positional arguments</span>
<span class="s">to the ``mas`` function (it is called as</span>
<span class="s">``mas(*mas_args)``.&#39;&#39;&#39;</span><span class="p">,</span>
        <span class="nb">type</span><span class="o">=</span><span class="p">(</span><span class="nb">tuple</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">),</span>
        <span class="n">default</span><span class="o">=</span><span class="p">()),</span>

    <span class="n">mas_f77</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
        <span class="n">help</span><span class="o">=</span><span class="s">&#39;&#39;&#39;Fortran subroutine for mas.</span>
<span class="s">This subroutine has the signature</span>
<span class="s">(note that rpar,ipar are not used)::</span>

<span class="s">        subroutine mas_f77(neq,mas,lmas,rpar,ipar)</span>
<span class="s">  Cf2py intent(hide)   rpar,ipar</span>
<span class="s">  Cf2py intent(in)     neq,lmas</span>
<span class="s">  Cf2py intent(out)    mas</span>
<span class="s">        integer neq,lmas,ipar</span>
<span class="s">        double precision mas(lmas,neq),rpar</span>
<span class="s">        mas(1,1) = ...</span>
<span class="s">        ...</span>
<span class="s">        return</span>
<span class="s">        end</span>

<span class="s">&#39;&#39;&#39;</span><span class="p">,</span>
        <span class="nb">type</span><span class="o">=</span><span class="nb">callable</span><span class="p">),</span>

    <span class="n">mlmas</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
        <span class="n">help</span><span class="o">=</span><span class="s">&#39;Lower bandwith of mass matrix M&#39;</span><span class="p">,</span>
        <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">),</span>

    <span class="n">mumas</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
        <span class="n">help</span><span class="o">=</span><span class="s">&#39;Upper bandwith of mass matrix M&#39;</span><span class="p">,</span>
        <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">),</span>

    <span class="n">jac_f77_radau5</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
        <span class="n">help</span><span class="o">=</span><span class="s">&#39;&#39;&#39;Fortran subroutine for jac to be</span>
<span class="s">provided to Radau5. This subroutine should be</span>
<span class="s">defined as (note that rpar,ipar are not used)::</span>

<span class="s">        subroutine jac_f77_radau5</span>
<span class="s">       &amp;           (neq,t,u,dfu,ldfu,rpar,ipar)</span>
<span class="s">  Cf2py intent(hide) neq,rpar,ipar</span>
<span class="s">  Cf2py intent(in)   t,u,ldfu</span>
<span class="s">  Cf2py intent(out) dfu</span>
<span class="s">        integer neq,ipar,ldfu</span>
<span class="s">        double precision t,u,dfu,rpar</span>
<span class="s">        dimension u(neq),dfu(ldfu,neq)</span>
<span class="s">        dfu(1,1) = ...</span>
<span class="s">        dfu(1,2) = ...</span>
<span class="s">        ...</span>
<span class="s">        return</span>
<span class="s">        end</span>

<span class="s">&#39;&#39;&#39;</span><span class="p">,</span>
        <span class="nb">type</span><span class="o">=</span><span class="nb">callable</span><span class="p">),</span>
<span class="p">)</span>

<span class="kn">import</span> <span class="nn">solvers</span>
<span class="n">solvers</span><span class="o">.</span><span class="n">_parameters</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">_parameters_Radau5</span><span class="p">)</span>


<div class="viewcode-block" id="Radau5"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5">[docs]</a><span class="k">class</span> <span class="nc">Radau5</span><span class="p">(</span><span class="n">Solver</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    This is a wrapper for radau5.f, a file containing the</span>
<span class="sd">    the ``radau5`` FORTRAN subtroutine for the numerical solution</span>
<span class="sd">    of a stiff ODEs or differential algebraic (DAE) systems,</span>
<span class="sd">    involving first order equations on the form</span>

<span class="sd">    .. math:: Mu&#39; = f(u,t).</span>

<span class="sd">    The ODE system can be linearly implicit (mass-matrix :math:`M`</span>
<span class="sd">    is not identity matrix) or explicit.</span>

<span class="sd">    The method used is an implicit Runge-Kutta method (Radau IIA)</span>
<span class="sd">    of order 5 with step size control. The file ``radau5.f`` can</span>
<span class="sd">    be downloaded from `&lt;http://www.unige.ch/~hairer/software.html&gt;`_.</span>
<span class="sd">    Details about the implementation can be found in the book</span>
<span class="sd">    &quot;Solving Ordinary Differential Equations II, Stiff and</span>
<span class="sd">    Differential-Algebraic Problems&quot;, by E. Hairer and G. Wanner,</span>
<span class="sd">    2nd ed., 1996, published by Springer-Verlag (ISBN: 3-540-60452-9).</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">_optional_parameters</span> <span class="o">=</span> <span class="n">Solver</span><span class="o">.</span><span class="n">_optional_parameters</span> <span class="o">+</span> \
        <span class="p">[</span><span class="s">&#39;f_f77&#39;</span><span class="p">,</span> <span class="s">&#39;jac_f77_radau5&#39;</span><span class="p">,</span> <span class="s">&#39;atol&#39;</span><span class="p">,</span> <span class="s">&#39;jac_banded&#39;</span><span class="p">,</span>
         <span class="s">&#39;rtol&#39;</span><span class="p">,</span> <span class="s">&#39;nsteps&#39;</span><span class="p">,</span> <span class="s">&#39;ml&#39;</span><span class="p">,</span> <span class="s">&#39;mu&#39;</span><span class="p">,</span> <span class="s">&#39;first_step&#39;</span><span class="p">,</span> <span class="s">&#39;jac&#39;</span><span class="p">,</span> <span class="s">&#39;safety&#39;</span><span class="p">,</span>
         <span class="s">&#39;max_step&#39;</span><span class="p">,</span> <span class="s">&#39;nsteps&#39;</span><span class="p">,</span> <span class="s">&#39;mas&#39;</span><span class="p">,</span> <span class="s">&#39;mas_f77&#39;</span><span class="p">,</span> <span class="s">&#39;mlmas&#39;</span><span class="p">,</span> <span class="s">&#39;mumas&#39;</span><span class="p">,</span>
         <span class="s">&#39;mas_args&#39;</span><span class="p">]</span>
    <span class="n">_error_messages</span> <span class="o">=</span> <span class="p">{</span>
        <span class="o">-</span><span class="mi">1</span><span class="p">:</span> <span class="s">&#39;INPUT IS NOT CONSISTENT&#39;</span><span class="p">,</span>
        <span class="o">-</span><span class="mi">2</span><span class="p">:</span> <span class="s">&#39;LARGER NMAX IS NEEDED&#39;</span><span class="p">,</span>
        <span class="o">-</span><span class="mi">3</span><span class="p">:</span> <span class="s">&#39;STEP SIZE BECOMES TOO SMALL&#39;</span><span class="p">,</span>
        <span class="o">-</span><span class="mi">4</span><span class="p">:</span> <span class="s">&#39;MATRIX IS REPEATEDLY SINGULAR&#39;</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">_extra_args_fortran</span> <span class="o">=</span> <span class="p">{}</span>

<div class="viewcode-block" id="Radau5.initialize"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.initialize">[docs]</a>    <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;Import extension module _radau5 and check that it exists.&#39;&#39;&#39;</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="kn">import</span> <span class="nn">_radau5</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_radau5</span> <span class="o">=</span> <span class="n">_radau5</span>
        <span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ImportError</span><span class="p">(</span><span class="s">&#39;Cannot find the extension module _radau5.</span><span class="se">\n</span><span class="s">Run setup.py again and investigate why _radau5.so was not successfully built.&#39;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Radau5.adjust_parameters"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.adjust_parameters">[docs]</a>    <span class="k">def</span> <span class="nf">adjust_parameters</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parameters</span><span class="p">[</span><span class="s">&#39;jac&#39;</span><span class="p">][</span><span class="s">&#39;default&#39;</span><span class="p">]</span>
            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parameters</span><span class="p">[</span><span class="s">&#39;nsteps&#39;</span><span class="p">][</span><span class="s">&#39;default&#39;</span><span class="p">]</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">pass</span>
</div>
<div class="viewcode-block" id="Radau5.validate_data"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.validate_data">[docs]</a>    <span class="k">def</span> <span class="nf">validate_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="c"># lower- &amp; upper-bound for banded Jacobian in range [0, neq]</span>
        <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">(</span><span class="s">&#39;ml&#39;</span><span class="p">,</span> <span class="s">&#39;mu&#39;</span><span class="p">,</span> <span class="s">&#39;mlmas&#39;</span><span class="p">,</span> <span class="s">&#39;mumas&#39;</span><span class="p">):</span>
            <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_parameters</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="s">&#39;range&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>

        <span class="n">has_banded_jac</span> <span class="o">=</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;jac_banded&#39;</span><span class="p">)</span>
        <span class="n">ml</span><span class="p">,</span> <span class="n">mu</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;ml&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">),</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mu&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">has_banded_jac</span> <span class="ow">and</span> <span class="p">((</span><span class="n">ml</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">mu</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">)):</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&#39;&quot;ml&quot; and &quot;mu&quot; have to be provided when banded Jacobian matrix is involved! Your input is (</span><span class="si">%s</span><span class="s">, </span><span class="si">%s</span><span class="s">).&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">ml</span><span class="p">,</span> <span class="n">mu</span><span class="p">))</span>
        <span class="k">return</span> <span class="n">Solver</span><span class="o">.</span><span class="n">validate_data</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Radau5.func_wrappers"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.func_wrappers">[docs]</a>    <span class="k">def</span> <span class="nf">func_wrappers</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;f&#39;</span><span class="p">):</span>
            <span class="c"># If f is input in form of a Python function f(u,t),</span>
            <span class="c"># let self.f_f77 wrap f and have arguments t, u.</span>
            <span class="n">f</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">f_f77</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">u</span><span class="p">,</span><span class="n">t</span><span class="p">))</span>
        <span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;f_f77&#39;</span><span class="p">):</span>
            <span class="c"># The right-hand side &quot;f&quot; is input as a Fortran function</span>
            <span class="c"># taking the arguments t,u.</span>
            <span class="c"># Set self.f to be f_f77 wrapped to the general form f(u,t)</span>
            <span class="c"># for switch_to().</span>
            <span class="n">f_f77</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_f77</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">f</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">u</span><span class="p">,</span><span class="n">t</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">f_f77</span><span class="p">(</span><span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">))</span>

        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;jac&#39;</span><span class="p">):</span>
            <span class="c"># If jac is input as full matrix in form of jac(u,t),</span>
            <span class="c"># wrap jac to jac_f77 for Fortran code.</span>
            <span class="n">jac</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">jac</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">jac_f77_radau5</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">jac</span><span class="p">(</span><span class="n">u</span><span class="p">,</span><span class="n">t</span><span class="p">),</span>
                                                         <span class="n">order</span><span class="o">=</span><span class="s">&#39;Fortran&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;jac_banded&#39;</span><span class="p">):</span>
            <span class="c"># If jac is input as banded matrix in form of jac_banded(u,t,ml,mu),</span>
            <span class="c"># wrap jac_banded to jac_f77_radau5 for Fortran code.</span>
            <span class="n">jac_banded</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">jac_banded</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_extra_args_fortran</span><span class="p">[</span><span class="s">&#39;jac_extra_args&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ml</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mu</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">jac_f77_radau5</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">,</span><span class="n">ml</span><span class="p">,</span><span class="n">mu</span><span class="p">:</span> \
                <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">jac_banded</span><span class="p">(</span><span class="n">u</span><span class="p">,</span><span class="n">t</span><span class="p">,</span><span class="n">ml</span><span class="p">,</span><span class="n">mu</span><span class="p">),</span> <span class="n">order</span><span class="o">=</span><span class="s">&#39;Fortran&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;jac_f77_radau5&#39;</span><span class="p">):</span>
            <span class="c"># If jas is input as Fortran subroutine</span>
            <span class="n">jac</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">jac_f77_radau5</span>
            <span class="k">if</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;ml&#39;</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">:</span>
                <span class="n">ljac</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ml</span> <span class="o">+</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mu&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">jac_banded</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">u</span><span class="p">,</span><span class="n">t</span><span class="p">,</span><span class="n">ml</span><span class="p">,</span><span class="n">mu</span><span class="p">:</span> <span class="n">jac</span><span class="p">(</span><span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">,</span><span class="n">ljac</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">jac</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">u</span><span class="p">,</span><span class="n">t</span><span class="p">:</span> <span class="n">jac</span><span class="p">(</span><span class="n">t</span><span class="p">,</span><span class="n">u</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">)</span>

        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mas&#39;</span><span class="p">):</span>
            <span class="c"># If mas is input as Python function in form of mas(*mas_args),</span>
            <span class="n">mas</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mas</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">mas_f77</span> <span class="o">=</span> <span class="k">lambda</span> <span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">mas</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">mas_args</span><span class="p">),</span>
                                               <span class="n">order</span><span class="o">=</span><span class="s">&#39;Fortran&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mas_f77&#39;</span><span class="p">):</span>
            <span class="c"># If mas is input as Fortran subroutine</span>
            <span class="n">mas</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mas_f77</span>
            <span class="k">if</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mlmas&#39;</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">:</span>
                <span class="n">lmas</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mlmas</span> <span class="o">+</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mumas&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">lmas</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">mas</span> <span class="o">=</span> <span class="k">lambda</span> <span class="p">:</span> <span class="n">mas</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">,</span> <span class="n">lmas</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Radau5.set_dummy_functions"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.set_dummy_functions">[docs]</a>    <span class="k">def</span> <span class="nf">set_dummy_functions</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">(</span><span class="s">&#39;jac_f77_radau5&#39;</span><span class="p">,</span> <span class="s">&#39;f_f77&#39;</span><span class="p">):</span>
            <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="mf">0.</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mas_f77&#39;</span><span class="p">):</span>
            <span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mas_f77&#39;</span><span class="p">,</span> <span class="k">lambda</span> <span class="p">:</span> <span class="mf">0.</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Radau5.set_tol"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.set_tol">[docs]</a>    <span class="k">def</span> <span class="nf">set_tol</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Tolerance parameters, rtol &amp; atol, can be provided as either two scalars</span>
<span class="sd">        or two vectors.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">rtol_scalar</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rtol</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">))</span>
        <span class="n">atol_scalar</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">atol</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">))</span>
        <span class="k">if</span> <span class="p">(</span><span class="n">rtol_scalar</span> <span class="ow">and</span> <span class="p">(</span><span class="ow">not</span> <span class="n">atol_scalar</span><span class="p">)):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">rtol</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">rtol</span><span class="p">]</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span>   <span class="c"># Wrap to vector</span>
        <span class="k">elif</span> <span class="p">(</span><span class="n">atol_scalar</span> <span class="ow">and</span> <span class="p">(</span><span class="ow">not</span> <span class="n">rtol_scalar</span><span class="p">)):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">atol</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">atol</span><span class="p">]</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span>   <span class="c"># Wrap to vector</span>
        <span class="c"># itol is a flag to indicate whether tolerance parameters are input</span>
        <span class="c"># as scalars or vectors</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">itol</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="ow">not</span><span class="p">(</span><span class="n">atol_scalar</span> <span class="o">&amp;</span> <span class="n">rtol_scalar</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="Radau5.initialize_for_solve"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.initialize_for_solve">[docs]</a>    <span class="k">def</span> <span class="nf">initialize_for_solve</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">func_wrappers</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">set_tol</span><span class="p">()</span>
        <span class="c"># Flags to indicate whether jac and mas are provided</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ijac</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;jac_f77_radau5&#39;</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">imas</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mas_f77&#39;</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">set_dummy_functions</span><span class="p">()</span>

        <span class="n">ljac</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span> <span class="k">if</span> <span class="p">((</span><span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;ml&#39;</span><span class="p">))</span> <span class="ow">or</span> \
            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ml</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">))</span> <span class="k">else</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ml</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">mu</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
        <span class="n">lmas</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">imas</span> <span class="k">else</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">neq</span> \
            <span class="k">if</span> <span class="p">((</span><span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mlmas&#39;</span><span class="p">))</span> <span class="ow">or</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mlmas</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">))</span> \
                 <span class="k">else</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mlmas</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">mumas</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span>
        <span class="n">le</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span> <span class="k">if</span> <span class="p">((</span><span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;ml&#39;</span><span class="p">))</span> <span class="ow">or</span> \
            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ml</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">))</span> <span class="k">else</span> <span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">ml</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">mu</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">lwork</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="o">*</span><span class="p">(</span><span class="n">ljac</span> <span class="o">+</span> <span class="n">lmas</span> <span class="o">+</span> <span class="mi">3</span><span class="o">*</span><span class="n">le</span> <span class="o">+</span> <span class="mi">12</span><span class="p">)</span> <span class="o">+</span> <span class="mi">20</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">liwork</span> <span class="o">=</span> <span class="mi">3</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">neq</span> <span class="o">+</span> <span class="mi">20</span>

        <span class="c"># Arrays to specify how the problem is to be solved.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">iwork</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">liwork</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">work</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lwork</span><span class="p">,</span> <span class="nb">float</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">iwork</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;nsteps&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">work</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;safety&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">work</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;max_step&#39;</span><span class="p">,</span> <span class="mf">0.</span><span class="p">)</span>

        <span class="n">Solver</span><span class="o">.</span><span class="n">initialize_for_solve</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>   <span class="c"># Common settings</span>

</div>
<div class="viewcode-block" id="Radau5.advance"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5.advance">[docs]</a>    <span class="k">def</span> <span class="nf">advance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        This function intends to one step forward with Radau5.</span>
<span class="sd">        &#39;&#39;&#39;</span>
        <span class="n">neq</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">n</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">u</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">n</span>
        <span class="n">t</span><span class="p">,</span> <span class="n">t_next</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">t</span><span class="p">[</span><span class="n">n</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">t</span><span class="p">[</span><span class="n">n</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span>

        <span class="n">mas</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mas_f77</span><span class="p">,</span> <span class="s">&#39;_cpointer&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mas_f77</span><span class="p">)</span>
        <span class="n">f</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">f_f77</span><span class="p">,</span> <span class="s">&#39;_cpointer&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">f_f77</span><span class="p">)</span>
        <span class="n">jac</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">jac_f77_radau5</span><span class="p">,</span> <span class="s">&#39;_cpointer&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">jac_f77_radau5</span><span class="p">)</span>

        <span class="n">h</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;first_step&#39;</span><span class="p">,</span> <span class="mf">0.</span><span class="p">)</span>
        <span class="n">ml</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;ml&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">)</span>
        <span class="n">mu</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mu&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
        <span class="n">mlmas</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mlmas&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">neq</span><span class="p">)</span>
        <span class="n">mumas</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;mumas&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>

        <span class="n">args</span> <span class="o">=</span> <span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">u</span><span class="p">[</span><span class="n">n</span><span class="p">]</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">t_next</span><span class="p">,</span> <span class="n">h</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">rtol</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">atol</span><span class="p">,</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">itol</span><span class="p">,</span> <span class="n">jac</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">ijac</span><span class="p">,</span> <span class="n">ml</span><span class="p">,</span> <span class="n">mu</span><span class="p">,</span>
                <span class="n">mas</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">imas</span><span class="p">,</span> <span class="n">mlmas</span><span class="p">,</span> <span class="n">mumas</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">work</span><span class="p">,</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">iwork</span><span class="p">)</span>

        <span class="c"># In the last demo, do not work without printing u_n out. Why?</span>
        <span class="c"># Try demo_Radau5_5_fortran.py</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        if not hasattr(self, &#39;printed&#39;):</span>
<span class="sd">            print u[n].copy()</span>
<span class="sd">            self.printed = True&quot;&quot;&quot;</span>

        <span class="n">u_new</span><span class="p">,</span> <span class="n">t_new</span><span class="p">,</span> <span class="n">iwork</span><span class="p">,</span> <span class="n">idid</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_radau5</span><span class="o">.</span><span class="n">advance_radau5</span><span class="p">(</span>
                             <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">_extra_args_fortran</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">idid</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>          <span class="c"># Error occurred</span>
            <span class="k">print</span> <span class="bp">self</span><span class="o">.</span><span class="n">_error_messages</span><span class="p">[</span><span class="n">idid</span><span class="p">]</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">t_new</span><span class="p">)</span>
            <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>   <span class="c"># Interrupt</span>
	<span class="k">return</span> <span class="n">u_new</span>

<span class="c">### end of class Radau5 ###</span>
</div></div>
<div class="viewcode-block" id="Radau5Explicit"><a class="viewcode-back" href="../../radau5.html#odespy.radau5.Radau5Explicit">[docs]</a><span class="k">class</span> <span class="nc">Radau5Explicit</span><span class="p">(</span><span class="n">Radau5</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Radau5 solver for explcit ODE problem.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_optional_parameters</span> <span class="o">=</span> <span class="n">Solver</span><span class="o">.</span><span class="n">_optional_parameters</span> <span class="o">+</span> \
        <span class="p">[</span><span class="s">&#39;f_f77&#39;</span><span class="p">,</span> <span class="s">&#39;jac_f77_radau5&#39;</span><span class="p">,</span> <span class="s">&#39;atol&#39;</span><span class="p">,</span> <span class="s">&#39;jac_banded&#39;</span><span class="p">,</span>
         <span class="s">&#39;rtol&#39;</span><span class="p">,</span> <span class="s">&#39;nsteps&#39;</span><span class="p">,</span> <span class="s">&#39;ml&#39;</span><span class="p">,</span> <span class="s">&#39;mu&#39;</span><span class="p">,</span> <span class="s">&#39;first_step&#39;</span><span class="p">,</span> <span class="s">&#39;jac&#39;</span><span class="p">,</span> <span class="s">&#39;safety&#39;</span><span class="p">,</span>
         <span class="s">&#39;max_step&#39;</span><span class="p">,</span> <span class="s">&#39;nsteps&#39;</span><span class="p">]</span>
</div>
<span class="n">Radau5Implicit</span> <span class="o">=</span> <span class="n">Radau5</span>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../../np-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">Odespy API 0.2 documentation</a> &raquo;</li>
          <li><a href="../index.html" >Module code</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Liwei Wang and Hans Petter Langtangen.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
    </div>
  </body>
</html>